package com.pp.web.controller;

import com.pp.common.pojo.District;
import com.pp.common.vo.SysResult;
import com.pp.web.service.IDistrictService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/api/district")
public class DistrictController extends BaseController {

    @Resource
    private IDistrictService districtService;

    @GetMapping("/{parentCode}")
    public SysResult getDistrict(@PathVariable String parentCode) {
        List<District> districtList = districtService.getByParentCode(parentCode);
        return SysResult.success(districtList);
    }
}
